<extend name="extends/extend" />
<block name="loadCss">
    <!--美化 checkbox radio css-->
    <link href="__admin__/css/plugins/iCheck/custom.css" rel="stylesheet">
</block>
<block name="script">
    <!--美化 checkbox radio js-->
    <script src="__admin__/js/plugins/iCheck/icheck.min.js"></script>
    <!--表单验证 插件-->
    <script src="__admin__/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="__admin__/js/plugins/validate/messages_zh.min.js"></script>
    <script>
        $(document).ready(function () {
            $(".i-checks").iCheck({
                checkboxClass:"icheckbox_square-green",
                radioClass:"iradio_square-green",
            });
            $('#checkForm').validate({
                submitHandler:function(form) {
                    form.submit();
                },
                highlight: function(e) {
                    $(e).closest(".form-group").removeClass("has-success").addClass("has-error")
                },
                success: function(e) {
                    e.closest(".form-group").removeClass("has-error")
                },
                errorClass: "help-block m-b-none",
                rules:{
                    status:{required:true}
                }
            });

        });
    </script>
</block>
<block name="content">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>更新配置</h5>
                        <div class="ibox-tools">
                            <a href="javascript:history.go(-1);" class="btn btn-outline btn-info btn-xs">
                                <i class="fa fa-arrow-circle-left"></i> 返回
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <form method="post" action="" class="form-horizontal" id="checkForm">

                            <div class="form-group">
                                <label class="col-sm-2 control-label">标识名</label>
                                <div class="col-sm-10">
                                    <input type="text" name="mark" value="{$config.mark}" onkeyup="this.value=this.value.toUpperCase()"  required class="form-control">
                                    <span class="help-block m-b-none">大写,多个词以下划线分割！</span>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">配置名</label>
                                <div class="col-sm-10">
                                    <input type="text" name="name" value="{$config.name}"  required class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">分组</label>
                                <div class="col-sm-10">
                                    <select class="form-control m-b" name="groups">
                                        <volist name="groups" id="v">
                                            <option value="{$v.groups_id}" <eq name="v.groups_id" value="$config.groups">selected</eq> >{$v.title}</option>
                                        </volist>
                                    </select>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">数据类型</label>
                                <div class="col-sm-10">
                                    <select class="form-control m-b" name="type">
                                        <volist name="types" id="v">
                                            <option value="{$v.type_id}" <eq name="v.type_id" value="$config.type">selected</eq> >{$v.title}</option>
                                        </volist>
                                    </select>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">默认值</label>
                                <div class="col-sm-10">
                                    <textarea  name="value" class="form-control">{$config.value}</textarea>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">提示信息/描述</label>
                                <div class="col-sm-10">
                                    <textarea  name="description" class="form-control">{$config.description}</textarea>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">表单选项<br><small class="text-navy">此项为选填</small></label>
                                <div class="col-sm-10">
                                    <select class="form-control m-b" name="form_view[element]">
                                        <option <eq name="element" value="select">selected</eq> value="select">下拉选择(select)</option>
                                        <option <eq name="element" value="radio">selected</eq> value="radio">单选(radio)</option>
                                        <option <eq name="element" value="checkbox">selected</eq> value="checkbox">多选(checkbox)</option>
                                        <option <eq name="element" value="textarea">selected</eq> value="textarea">文本域(textarea)</option>
                                        <option <eq name="element" value="text">selected</eq> value="text">文本(text)</option>
                                        <option <eq name="element" value="file">selected</eq> value="file">上传(file)</option>
                                    </select>
                                    <textarea rows="6" name="form_view[value]" class="form-control">{$value}</textarea>
                                    <span class="help-block m-b-none bg-warning">
                                        每一行代表一项,每项 值|值名称 <br>例如选择 "单选(radio)":
                                        1|男
                                        0|女
                                    </span>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">排序</label>
                                <div class="col-sm-10">
                                    <input type="text" name="sort" value="{$config.sort}" required class="form-control">
                                    <span class="help-block m-b-none">倒排序,意味着数字越大排序也高！</span>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">状态</label>
                                <div class="col-sm-10">
                                    <div class="radio i-checks">
                                        <label>
                                            <input type="radio" value="1" <eq name="config.status" value="1">checked</eq> name="status"> <i></i> 正常</label>
                                    </div>
                                    <div class="radio i-checks">
                                        <label>
                                            <input type="radio" value="0" <eq name="config.status" value="0">checked</eq> name="status"> <i></i> 禁用</label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    {:token()}
                                    <button class="btn btn-primary" type="submit">保存</button>
                                    <button class="btn btn-primary" type="reset">重置</button>
                                    <button class="btn btn-primary" type="button" onclick="history.go(-1)">返回</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</block>